package de.islanders.tests;

import static org.junit.Assert.*;

import org.junit.Test;

import de.islanders.shared.RandomBias;
import de.islanders.shared.RandomObject;

public class RandomBiasTest {

	@Test
	public void test() {
		RandomBias rnd = new RandomBias(1000000, true);
		System.out.println(rnd);
	
		rnd.addToObjects(new RandomObject<Integer>(160, 170, Integer.class));
		rnd.addToObjects(new RandomObject<Integer>(170, 180, Integer.class));
		rnd.addToObjects(new RandomObject<Integer>(180, 190, Integer.class));
		rnd.addToObjects(new RandomObject<Integer>(190, 200, Integer.class));
		rnd.addToObjects(new RandomObject<Integer>(200, 210, Integer.class));
		
		for(int i = 0; i < 1000000000; i++) {
			int height = rnd.next().intValue();
			assertTrue(height >= 160);
			assertTrue(height <= 210);
		}
		
		System.out.println("Done!");
		//rnd.updateObjectWeight();
		//rnd.printObjects();
	}
}
